package com.proton.carepatchtemp.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;

import com.proton.carepatchtemp.fragment.RealTimeItemFragment;

import java.util.List;

/**
 * Created by MoonlightSW on 2016/11/28.
 */

public class RealTimeTestAdapter extends FragmentStatePagerAdapter {

    private List<RealTimeItemFragment> mRealTimeItemFragments;
    private FragmentManager mFragmentManager;

    public RealTimeTestAdapter(FragmentManager fm, List<RealTimeItemFragment> realTimeItemFragments) {
        super(fm);
        this.mFragmentManager = fm;
        this.mRealTimeItemFragments = realTimeItemFragments;
    }

    public FragmentManager getFragmentManager() {
        return mFragmentManager;
    }

    @Override
    public Fragment getItem(int position) {
        return mRealTimeItemFragments.get(position);
    }

    @Override
    public int getItemPosition(Object object) {
        return PagerAdapter.POSITION_NONE;
    }

    @Override
    public int getCount() {
        return null == mRealTimeItemFragments ? 0 : mRealTimeItemFragments.size();
    }
}
